/**
 * Created by lizhijian on 2017/6/15.
 */
$(function(){
    // 全选按钮
    $(document).on('click','#zcheckbox',function(){
        if($(this).prop('checked')){
            $("tbody input[type='checkbox']").prop('checked',true);
        }else{
            $("tbody input[type='checkbox']").prop('checked',false);
        }
    });
    
    // 测试子iframe标签能否控制
    $(document).on('click','.addSlide-title span',function(){
        var $addContainer = $(".addContainer",window.parent.document);
        $addContainer.fadeOut();
        //清理OpFrame的src
        setTimeout(function(){
    		$('#opFrame',window.parent.document).attr("style","height:0px;width:0px;");	
        },100);
    });
    
    //列表页操作按钮
    $(document).on('click','.operate-more .operate-true,#carInfoAdd',function(){
        $(".operate-more ul").stop(true,false).hide(200);
       $(this).next().stop(true,false).slideToggle(200);
    });
    $(document).on('click','.operate-more ul',function(){
       $(this).hide();
    });
});

function insertTitle(path){
    var test1 = path.lastIndexOf("/");  //对路径进行截取
    var test2 = path.lastIndexOf("\\");  //对路径进行截取
    var test= Math.max(test1, test2);
    if(test<0){
       return path;
    }else{
       return path.substring(test + 1); //赋值文件名
    }
}

function setIframeHeight(iframe) {
    if (iframe) {
        var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
        if (iframeWin.document.body) {
            setTimeout(function(){
            	var iframeheight=$(iframe,window.parent.document).contents().find(".wrapper").height();
            	iframeheight+=150;
            	iframe.setAttribute('style',"height:"+iframeheight+'px;width:100%;');
            },200);
        }
    }
}